package com.maker.mcp.client.utils;

public class MakerResult {
    //响应业务状态
    private Integer status;

    //响应消息
    private String msg;

    //响应中的数据
    private Object data;

    public MakerResult build(Integer status, String msg, Object data) {
        return new MakerResult(status, msg, data);
    }

    public static MakerResult ok(Object data) {
        return new MakerResult(data);
    }

    public static MakerResult ok() {
        return new MakerResult(null);
    }

    public static MakerResult errorMsg(String msg){
        return new MakerResult(500,msg,null);
    }

    public static MakerResult errorUserTicket(String msg){
        return new MakerResult(557,msg,null);
    }

    public static MakerResult errorMap(Object data){
        return new MakerResult(501,"error",data);
    }

    public static MakerResult errorTokenMsg(String msg){
        return new MakerResult(502,msg,null);
    }

    public static MakerResult errorException(String msg){
        return new MakerResult(555,msg,null);
    }

    public MakerResult() {
    }
    public MakerResult(Object data) {
        this.status = 200;
        this.msg = "OK";
        this.data = data;
    }

    public MakerResult(Integer status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public MakerResult(Integer status, Object data) {
        this.status = status;
        this.data = data;
        this.msg = "OK";
    }

    public MakerResult(Integer status, String msg, Object data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
